package com.example.yuhuaqiu.myqq;

import android.content.Intent;
import android.graphics.BitmapFactory;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SearchView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MessageListActivity extends AppCompatActivity {
    private ListView list;
    private Button mes;
    private  Button tel;
    private SearchView sv;
    private List<Map<String,Object>> values;
    private MeAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_message_list);

        list = (ListView) findViewById(R.id.mes_list);
        values = new ArrayList<>();
        //设置图片质量为原来四分之一；
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inSampleSize = 4;
        Map<String,Object> map = new HashMap<>();
        map.put("name","婷宝宝");
        map.put("mes","Are you ready??");
        map.put("time","19:20");
        map.put("img", R.drawable.head);
        values.add(map);

        adapter = new MeAdapter(this,values);
        list.setAdapter(adapter);

        list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent intent = new Intent(MessageListActivity.this,TalkActivity.class);
                startActivity(intent);
                finish();
            }
        });
        SearchView sv = (SearchView) findViewById(R.id.sv);


    }


}
